app.controller('baseController',function($scope){
	
	//分页控件配置 
	$scope.paginationConf = {
			 currentPage: 1,
			 totalItems: 100,
			 itemsPerPage: 10,
			 perPageOptions: [3, 6, 9, 12, 50],
			 onChange: function(){
				 $scope.reloadList();
			 }
	}; 
	
	$scope.reloadList=function(){
		$scope.selectIds=[];
		$scope.findPage($scope.paginationConf.currentPage,$scope.paginationConf.itemsPerPage);
	}
	
	$scope.selectIds=[];
	$scope.updateSelects=function($event,id){
		if($event.target.checked){
			$scope.selectIds.push(id);
		}else{
			var idIndex = $scope.selectIds.indexOf(id);
			$scope.selectIds.splice(idIndex,1);
		}
	}
	// obj = {name:'jack'}     obj.name 'name'  obj['name']   ${emp.name} ${emp['name']}
	$scope.json2string=function(jsonstr,key){  // $.each()
		var json = JSON.parse(jsonstr);
		var str = "";
		for(var i=0;i<json.length;i++){
			str+=","+json[i][key];
		}
		str = str.substring(1);
		return str;
	}

}
);